package com.android.pagemarket.ui.widget;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;

import com.android.pagemarket.MyApplication;
import com.android.pagemarket.R;

/*********************************************************
 * @author : zhaohua
 * @version : 2012-11-1
 * @see : 拨打电话的弹出框
 * @Copyright : copyrights reserved by personal 2007-2011
 **********************************************************/
public class DirectPopWindow extends PopupWindow implements PopupWindow.OnDismissListener
{  
    public DirectPopWindow(Context context)
    {
        super(LayoutInflater.from(context).inflate(R.layout.popview_direct,null), 
              LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
        setBackgroundDrawable(new ColorDrawable(0x99000000));
        setTouchable(true);
        setFocusable(true);
        initViews();
        setOnDismissListener(this);
    }
    
    private void initViews()
    {
        View v = getContentView();
        v.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                dismiss();
            }
        });
    }

    @Override
    public void onDismiss() 
    {
        MyApplication.getContext().setDireactable();
    }
}